<fieldset>
    <legend>条件搜索</legend>
    <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
        <div class="layui-form-item layui-inline">
            <label class="layui-form-label">商品名称</label>
            <div class="layui-input-inline">
                <input name="title" value="{$Think.get.title|default=''}" placeholder="请输入商品名称" class="layui-input">
            </div>
        </div>

<!--        <div class="layui-form-item layui-inline" style="display: none">-->
<!--            <label class="layui-form-label">商品分类</label>-->
<!--            <div class="layui-input-inline">-->
<!--                <select class="layui-select" name="cate_id" lay-search>-->
<!--                    <option value="">&#45;&#45; 全部分类 &#45;&#45;</option>-->
<!--                    {foreach $clist as $k =>&$v}-->
<!--                    &lt;!&ndash;{eq name='Think.get.cate_id' value='$v.id.""'}&ndash;&gt;-->
<!--                    <option selected value="{$v.id}">{$v.spl|raw} - {$v.title}</option>-->
<!--                    &lt;!&ndash;{else}&ndash;&gt;-->
<!--                    <option value="{$v.id}">{$v.spl|raw} - {$v.title}</option>-->
<!--                    &lt;!&ndash;{/eq}&ndash;&gt;-->
<!--                    {/foreach}-->
<!--                </select>-->
<!--            </div>-->
<!--        </div>-->


        <div class="layui-form-item layui-inline" >
            <label class="layui-form-label">商品一级分类</label>
            <div class="layui-input-inline">
                <select class="layui-select" name="cate_id_one" id="cate_id_one" lay-search lay-filter="cate_id_one">
                    <option value="">-- 全部 --</option>
                    {foreach $clist_one as $k =>&$v}
                    <!--{eq name='Think.get.cate_id_one' value='$v.id.""'}-->
                    <option selected value="{$v.id}">{$v.title}</option>
                    <!--{else}-->
                    <option value="{$v.id}">{$v.title}</option>
                    <!--{/eq}-->
                    {/foreach}
                </select>
            </div>
        </div>

        <div class="layui-form-item layui-inline" style="display: none">
            <label class="layui-form-label">商品二级分类</label>
            <div class="layui-input-inline">
                <select class="layui-select" name="cate_id_two" id="cate_id_two" lay-search lay-filter="cate_id_two">
                        <option value="">-- 全部分类 --</option>
                        {foreach $clist_two as $k =>&$v}
                        <!--{eq name='Think.get.cate_id_two' value='$v.id.""'}-->
                        <option selected value="{$v.id}">{$v.title}</option>
                        <!--{else}-->
                        <option value="{$v.id}">{$v.title}</option>
                        <!--{/eq}-->
                        {/foreach}
                </select>
            </div>
        </div>

        <div class="layui-form-item layui-inline" style="display: none">
            <label class="layui-form-label">商品三级分类</label>
            <div class="layui-input-inline">
                <select class="layui-select" name="cate_id" id="cate_id" lay-search lay-filter="cate_id">
                    <option value="">-- 全部分类 --</option>
                    {foreach $clist_three as $k =>&$v}
                    <!--{eq name='Think.get.cate_id' value='$v.id.""'}-->
                    <option selected value="{$v.id}">{$v.title}</option>
                    <!--{else}-->
                    <option value="{$v.id}">{$v.title}</option>
                    <!--{/eq}-->
                    {/foreach}
                </select>
            </div>
        </div>

        <div class="layui-form-item layui-inline">
            <label class="layui-form-label">所属店铺</label>
            <div class="layui-input-inline">
                <select class="layui-select" name="shop_id" lay-search>
                    <option value="">-- 全部店铺 --</option>
                    {foreach $shop_list as $k =>&$v}
                    <!--{eq name='Think.get.shop_id' value='$v.id.""'}-->
                    <option selected value="{$v.id}">{$v.title}</option>
                    <!--{else}-->
                    <option value="{$v.id}">{$v.title}</option>
                    <!--{/eq}-->
                    {/foreach}
                </select>
            </div>
        </div>

        <div class="layui-form-item layui-inline">
            <label class="layui-form-label">类型标签</label>
            <div class="layui-input-inline">
                <select class="layui-select" name="text_id" lay-search>
                    <option value="">-- 全部标签 --</option>
                    {foreach $text_list as $k =>&$v}
                    <!--{eq name='Think.get.text_id' value='$v.id.""'}-->
                    <option selected value="{$v.id}">{$v.title}</option>
                    <!--{else}-->
                    <option value="{$v.id}">{$v.title}</option>
                    <!--{/eq}-->
                    {/foreach}
                </select>
            </div>
        </div>

        <div class="layui-form-item layui-inline">
            <label class="layui-form-label">导航标签</label>
            <div class="layui-input-inline">
                <select class="layui-select" name="tag_id" lay-search>
                    <option value="">-- 全部标签 --</option>
                    {foreach $tag_list as $k =>&$v}
                    <!--{eq name='Think.get.tag_id' value='$v.id.""'}-->
                    <option selected value="{$v.id}">{$v.title}</option>
                    <!--{else}-->
                    <option value="{$v.id}">{$v.title}</option>
                    <!--{/eq}-->
                    {/foreach}
                </select>
            </div>
        </div>


        <div class="layui-form-item layui-inline">
            <label class="layui-form-label">销售状态</label>
            <div class="layui-input-inline">
                <select class="layui-select" name="status">
                    {foreach [''=>'- 全部状态 -','1'=>'销售中商品','0'=>'已下架商品'] as $k=>$v}
                    <!--{eq name='Think.get.status' value='$k.""'}-->
                    <option selected value="{$k}">{$v}</option>
                    <!--{else}-->
                    <option value="{$k}">{$v}</option>
                    <!--{/eq}-->
                    {/foreach}
                </select>
            </div>
        </div>
        <div class="layui-form-item layui-inline">
            <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
        </div>
    </form>
    <script>form.render()</script>
    <script>

        layui.use(['layer', 'form'], function () {
            var layer = layui.layer

                , form = layui.form;

            form.on('select(cate_id_one)', function (data) {
                $("#cate_id_two").html('');


                var cate_id_one = $("#cate_id_one").val();

                $.ajax({

                    type: 'POST',

                    url: "{:url('store/goods/cate_id_one')}",

                    data: { cate_id_one: cate_id_one },

                    dataType: 'json',

                    success: function (data) {
                        $("#cate_id_two").html('');
                        var option1 = $("<option>").val('').text('请选择');
                        $("#cate_id_two").append(option1);
                        form.render('');

                        $.each(data, function (key, val) {

                            var option1 = $("<option>").val(val.id).text(val.title);

                            $("#cate_id_two").append(option1);

                            form.render('select');

                            //$("#City").get(0).selectedIndex=0;

                        });

                    }

                });

            });



        });


        layui.use(['layer', 'form'], function () {
            var layer = layui.layer

                , form = layui.form;

            form.on('select(cate_id_two)', function (data) {
                $("#cate_id").html('');


                var cate_id_two = $("#cate_id_two").val();

                $.ajax({

                    type: 'POST',

                    url: "{:url('store/goods/cate_id_two')}",

                    data: { cate_id_two: cate_id_two },

                    dataType: 'json',

                    success: function (data) {
                        $("#cate_id").html('');
                        var option1 = $("<option>").val('').text('请选择');
                        $("#cate_id").append(option1);
                        form.render('');

                        $.each(data, function (key, val) {

                            var option1 = $("<option>").val(val.id).text(val.title);

                            $("#cate_id").append(option1);

                            form.render('select');

                            //$("#City").get(0).selectedIndex=0;

                        });

                    }

                });

            });



        });

    </script>
</fieldset>